<template>
  <div>
    <div>我是子组件 {{money}}</div>
    <button @click="changeMoney">changeMoney</button>
  </div>
</template>

<script>
import { onMounted } from '@vue/runtime-core'
export default {
  name: 'Son',
  props: {
    money: {
      type: Number,
      default: 0
    }
  },
  setup (props, context) {
    // 获取父组件数据money
    console.log (props.money)

    // 子传父
    const changeMoney = () => {
      context.emit ('change-money', 50)
    }

    return {changeMoney}
  }
}
</script>

<style>

</style>